import { QUOTATION_NEGOTATIATE_STATE_STATUS, QUOTATION_NEGOTATIATE_STATUS, QUOTATION_STATUS } from '@/constant/goods'
import { PURCHASEWAY_OPTIONS } from '@/constant/purchase'
import { Empty } from 'antd'
export const searchConfig = ({
  DICTDATA,
  classBig,
  SpuOptions,
  handleSearchSpu,
  SupplierOption,
  handleSearchSupplier,
  ProDevSeason,
  FabricOption,
  handleSearchFabric,
  isRoot,
}: {
  DICTDATA: IDICTDATAType
  ProDevSeason: IOptionItem[]
  classBig: IOptionItem[]
  SpuOptions: IOptionItem[]
  handleSearchSpu: (newVal: string) => void
  SupplierOption: IOptionItem[]
  handleSearchSupplier: (newVal: string) => void
  FabricOption: IOptionItem[]
  handleSearchFabric: (newVal: string) => void
  isRoot: boolean
}) => {
  return [
    {
      label: 'SPU商品',
      name: 'spuDevIds',
      type: 'Select',
      placeholder: '款式编码/款式名称/设计编码/厂家款号',
      option: SpuOptions,
      config: {
        suffixIcon: null,
        showSearch: true,
        filterOption: false,
        optionFilterProp: 'label',
        mode: 'multiple',
        maxTagCount: 'responsive',
        onSearch: handleSearchSpu,
        notFoundContent: <Empty description="请输入内容搜索" image={Empty.PRESENTED_IMAGE_SIMPLE} />,
      },
    },
    {
      name: 'supplierIds',
      label: '供应商',
      type: 'Select',
      option: SupplierOption,
      placeholder: '请选择供应商',
      config: {
        showSearch: true,
        optionFilterProp: 'label',
        filterOption: false,
        mode: 'multiple',
        maxTagCount: 'responsive',
        onSearch: handleSearchSupplier,
      },
    },
    {
      label: '创建时间',
      name: 'createTimeStart',
      type: 'FixedRangePicker',
      config: { showTime: true, customFormat: 'YYYY-MM-DD HH:mm:ss' },
    },
    {
      name: 'quotationStatusList',
      label: '报价单状态',
      type: 'Select',
      option: QUOTATION_STATUS,
      placeholder: '请选择报价单状态',
      config: {
        showSearch: true,
        optionFilterProp: 'label',
        mode: 'multiple',
        maxTagCount: 'responsive',
      },
    },
    {
      name: 'quotationStageList',
      label: '报价阶段',
      type: 'Select',
      option: QUOTATION_NEGOTATIATE_STATE_STATUS,
      placeholder: '请选择报价阶段',
      hidden: !isRoot,
      config: {
        showSearch: true,
        optionFilterProp: 'label',
        mode: 'multiple',
        maxTagCount: 'responsive',
      },
    },
    {
      label: '大类',
      name: 'bigClassId',
      type: 'Select',
      option: classBig,
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
    },
    {
      name: 'seasonId',
      label: '开发季',
      type: 'Select',
      option: ProDevSeason,
      placeholder: '请选择开发季',
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
    },
    {
      label: '报价单号',
      name: 'quotationOrderCode',
      placeholder: '请输入报价单号',
      type: 'Input',
    },
    {
      name: 'designerName',
      label: '设计师/买手',
      type: 'Input',
      placeholder: '请输入设计师/买手',
    },
    {
      label: '报价确认时间',
      name: 'confirmTimeStart',
      type: 'FixedRangePicker',
      config: { showTime: true, customFormat: 'YYYY-MM-DD HH:mm:ss' },
    },
    {
      label: '采购方式',
      name: 'purchaseType',
      type: 'Select',
      option: PURCHASEWAY_OPTIONS,
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
    },
    {
      label: '订单类型',
      name: 'orderType',
      type: 'Select',
      option: [
        { label: '首单', value: 0 },
        { label: '返单', value: 1 },
      ],
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
    },
    {
      name: 'materialsKeyword',
      label: '面料',
      type: 'Input',
      placeholder: '面料名称/面料编码',
    },
    {
      label: '意向采购单号',
      name: 'intentOrderCode',
      placeholder: '请输入意向采购单号',
      type: 'Input',
    },
    {
      label: '正式采购单号',
      name: 'purchaseOrderCode',
      placeholder: '请输入正式采购单号',
      type: 'Input',
    },
  ]
}

export const useFormExport = (): IItemArray[] => {
  return [
    {
      label: '导出数据维度',
      name: 'exportDataTypeList',
      type: 'Checkbox',
      option: [
        { label: '色', value: 'exportSkc' },
        { label: '尺码', value: 'exportSku' },
      ],
    },
  ]
}
